package com.yuncheng.spcyApi.service.impl;

import com.yuncheng.spcyApi.constant.common.SpcyConstant;
import com.yuncheng.spcyApi.entity.SpcySqsxDxyxfsjl;
import com.yuncheng.spcyApi.mapper.SpcySqsxDxyxfsjlMapper;
import com.yuncheng.spcyApi.service.ISpcySqsxDxyxfsjlService;
import com.yuncheng.spcyApi.utils.GetCurrentUserUtils;
import com.yuncheng.spcyApi.utils.GetUuIdUtils;
import org.springframework.stereotype.Service;

import com.yuncheng.common.base.service.impl.BaseServiceImpl;

import java.util.Date;

/**
 * @Description: 审评查验-短信邮箱发送记录
 * @Author: csx
 * @Date: 2023-03-03
 * @Version: V1.0
 */
@Service
public class SpcySqsxDxyxfsjlServiceImpl extends BaseServiceImpl<SpcySqsxDxyxfsjlMapper, SpcySqsxDxyxfsjl> implements ISpcySqsxDxyxfsjlService {

    @Override
    public void initDxyxFsjl(String fywhm, String fname, String pid, String ffsnr, String ftype1, boolean isSuccess) {
        SpcySqsxDxyxfsjl spcySqsxDxyxfsjl = new SpcySqsxDxyxfsjl();
        spcySqsxDxyxfsjl.setId(GetUuIdUtils.ReplaceUuId());
        spcySqsxDxyxfsjl.setFywhm(fywhm);
        spcySqsxDxyxfsjl.setFname(fname);
        spcySqsxDxyxfsjl.setFsqsxid(pid);
        spcySqsxDxyxfsjl.setFfsnr(ffsnr);
        spcySqsxDxyxfsjl.setFfsr(GetCurrentUserUtils.getCurrentUserName());
        spcySqsxDxyxfsjl.setFfssj(new Date());
        spcySqsxDxyxfsjl.setFtype1(SpcyConstant.FILE_TYPE_SMS); // 短信
        if (isSuccess) {
            spcySqsxDxyxfsjl.setFfszt(SpcyConstant.SMS_STATE_TYPE1);// 成功
        }else {
            spcySqsxDxyxfsjl.setFfszt(SpcyConstant.SMS_STATE_TYPE2);// 失败
        }
        save(spcySqsxDxyxfsjl);
    }
}
